home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr27 / fdate89a.zip / FDATEBEG.DOC < prev    next >
Text File  |  1995-02-20  |  8KB  |  187 lines

  1. FDATEBEG.DOC    --   A "quick start" introduction to using Fdate
  2. ======================================================================
  3. Revision date: 1995 Feb 17
  4.  
  5. INTRODUCTION
  6. ============
  7. Basically, Fdate is a utility for doing date formatting and date arithmetic
  8. in DOS batch files.  Over the years, many other functions have been added
  9. to Fdate to support other activities that people often need to do when
  10. working with dates (simple arithmetic, for instance).
  11.  
  12. As Fdate has grown in functionality over the years, the documentation has
  13. grown so much that it is now overwhelming: new Fdate users have no idea
  14. where to start, or how to use the documentation to figure out how to make
  15. Fdate do what they need to do.
  16.  
  17. To help you get started using Fdate, I've created this short file called
  18. FDATEBEG.DOC (FDATE beginners documentation), which shows how to use Fdate
  19. to do the things most users want to do.  If you're using Fdate for the
  20. first time, I suggest that you start by reading this.  
  21.  
  22. When you've finished, you may still have a question: "Can I do such-and-
  23. such with Fdate?"  If it involves dates, it can probably be done with
  24. Fdate, although tricky things are of course tricky to do, even with Fdate.  
  25. A good next step would be to look at the list of examples in FDATE.DOC. 
  26. With luck, you will find Fdate doing such-and-such in one of the examples. 
  27. To understand how Fdate is working in a particular example, use the
  28. "language reference manual" part of the FDATE.DOC to look up the parameters
  29. used in the example.
  30.  
  31. When all else fails, reading the documentation often proves useful.
  32.  
  33.    Good Luck! 
  34.    Steve Ferg
  35.  
  36.  
  37.  
  38. THE 3-MINUTE INTRODUCTION TO FDATE
  39. ==================================
  40.  
  41. By far the most popular use of Fdate is to put today's date-- in a
  42. particular format-- into an environment variable.  Once this has been done,
  43. the environment variable can be used and manipulated in many ways in a
  44. batch file.  Here are a few short exercises that will help you to learn how
  45. to use Fdate's most basic features to do that.
  46.  
  47.  
  48. 1.
  49. At the DOS prompt, type:  
  50.   
  51.        FDATE
  52.  
  53.   This will show you Fdate's HELP screens.  Press ENTER to page through
  54.   the HELP screens.
  55.  
  56.   The information on these HELP screens is very dense.  It won't teach you
  57.   how to use Fdate, but it is useful for jogging your memory as you become
  58.   familiar with Fdate's various features.
  59.  
  60. 2.
  61. At the DOS prompt, type:  
  62.  
  63.        FDATE /Ff
  64.  
  65.   I've used lowercase "f" here to distinguish the value of the parameter
  66.   from the parameter-letter itself, but it really doesn't matter whether
  67.   the parameter or its value is in upper or lower case.  Except for the /K
  68.   parameter (one of Fdate's advanced features), Fdate's parameters are not
  69.   case sensitive.
  70.  
  71.   Here, the value of the "/F" (function) parameter is "f" (format a date). 
  72.   The "/Ff" parameter tells Fdate that the function you want it to perform
  73.   is to format a date.  Since the default date is "today", this command
  74.   will cause Fdate to display today's date on your screen in Fdate's
  75.   default output format.
  76.  
  77. 3.
  78. At the DOS prompt, type:
  79.  
  80.        FDATE /Ff /P"Today is "
  81.  
  82.   This command is just like the one in the previous example, except that
  83.   we've specified the "prefix parameter" (/P), which tells Fdate to add a
  84.   string to the beginning of its output.  (There is also a "suffix
  85.   parameter" that tells Fdate to add a string to the end of its output.) 
  86.   Note that the value of the /P parameter is enclosed in quotes.  (Either
  87.   single quotes or double quotes will work.)  We've had to enclose the
  88.   value in quotes because it contains embedded blanks (one blank after the
  89.   word "today" and a another after the word "is"). 
  90.  
  91. 4.
  92. At the DOS prompt, type: 
  93.  
  94.        FDATE /Ff /Occyymmdd
  95.  
  96.   (Or you can put the same statement in a batch file.)
  97.  
  98.   Here, you are telling Fdate to put out today's date in a specific
  99.   format.  On the "output format" parm (/O) you are specifying that you
  100.   want the day in "ccyymmdd" format: two digits each for century, year-
  101.   within-century, month, day-of-month.
  102.  
  103.   Note that the /O parm is not free-format.  Fdate supports many (but a
  104.   finite number) of output formats.  If you request output in (for
  105.   example) "yyccddmm" format, Fdate will reject your request, because it
  106.   does not support that particular output format.  Then you will have to
  107.   "roll your own" date format (see below).
  108.  
  109. 5.
  110. At the DOS prompt, type:
  111.  
  112.        FDATE /Ff /Omm/dd/ccyy 
  113.  
  114.   Here, you are telling Fdate to put out today's date in another of its
  115.   supported output formats, in this case "mm/dd/ccyy".
  116.  
  117.  
  118. 6.
  119. At the DOS prompt, type:
  120.  
  121.        FDATE /Ff /Occyymmdd /Vdate1
  122.  
  123.   (Or you can put the same statement in a batch file.)
  124.  
  125.   Here, you are telling Fdate to put out today's date in "ccyymmdd"
  126.   format.  Because you are specifying the "environment variable" parm (/V)
  127.   as "date1", Fdate is not writing its output to the screen.  It is
  128.   putting its output in an environment variable called "date1".  Now, if
  129.   you type "SET" at the DOS prompt, and if today is February 1, 1995, you
  130.   will see as the last line of the SET output:
  131.  
  132.             DATE1=19950201
  133.  
  134.   At this point, you know everything you need to know to put today's date
  135.   into an environment variable, which you can then use for whatever you
  136.   want.  Here's an example in which you are copying a file (BACKUP.LOG,
  137.   which is put out by a backup program) to a file whose name contains
  138.   today's date.
  139.  
  140.             FDATE /Ff /Occyymmdd /Vdate1
  141.             copy BACKUP.LOG  %date1%.LOG
  142.  
  143. 7.
  144.   Everybody, it seems, has their own preferred, and often unique, date
  145.   format.  Most likely, you will want the date in some format other than
  146.   "ccyymmdd". 
  147.  
  148.   To see if Fdate supports the output format that you want, look at the
  149.   FDATE help screens (as you did in step 1, above), or look at the
  150.   complete documentation in FDATE.DOC.
  151.  
  152.   If you find that Fdate does not support the precise date format that you
  153.   want, you can "roll your own" by putting one component of the date into
  154.   an environment variable, and then using the /P (prefix) facility to
  155.   concatenate it onto the front of another component of the date.  Using
  156.   this technique, you can build up virtually any date format you might
  157.   want.  Here is an example.  You can copy it into a batch file and see
  158.   that it actually does what it is supposed to do.
  159.  
  160.      @echo off
  161.      :: create a date in custom format: yy-mn3-dd
  162.      Fdate /Ff /Oyy          /Vx
  163.      Fdate /Ff /Omn3 /P"%x%-" /Vx
  164.      Fdate /Ff /Odd  /P"%x%-" /Vx
  165.      echo Today is %x%
  166.  
  167.  
  168. WHAT TO DO NEXT?
  169. ================
  170. Now that you have the basics down pat, you might like to explore FDATE.DOC. 
  171. It documents many more features of FDATE.  
  172.  
  173. One of the most useful parts of FDATE.DOC is the list of examples.  Browse
  174. through the titles of the examples in the Table of Contents of FDATE.DOC,
  175. getting a feel for what is there.  Then look at the examples themselves. 
  176. Many are quite elaborate (which is natural, since they are there to show
  177. you how to do Hard Stuff).  
  178.  
  179. Most of the examples are self-contained-- if you copy the text of the
  180. example into a batch file, the example code will run and do what the title
  181. says it will do.  I suggest you try doing so with one or two of the
  182. examples that seem most interesting to you.
  183.  
  184. After the examples, the most useful parts of FDATE.DOC are the sections
  185. documenting Fdate's various functions (the functions that you can specify
  186. on the function parm, /F) and its various output formats.  I suggest you
  187. scan those sections, just to get a quick feel for what's available to you.